package com.sts.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.sts.bean.Car_run;
import com.sts.dao.IRun_car;

@Service
public class Car_runService implements ICar_run {

	
	private Logger log = Logger.getLogger(this.getClass());
	@Resource
	private IRun_car irun_car ;
	
	
	@Override
	public int insertCar_run(Car_run carrun) {
		int result = irun_car.insertCar_run(carrun);
		return result;
	}

	@Override
	public List<Car_run> selCar_run(String car_id, String date_save_ele) {
		List<Car_run> list = new ArrayList<Car_run>();
		Map<String,Object> map = new HashMap<String,Object>() ;
		if(car_id == null){
			car_id = "";
		}
		if(date_save_ele == null){
			date_save_ele = "";
		}
		map.put("car_id", car_id);
		map.put("date_save_ele", date_save_ele);
		log.debug(map);
		list = irun_car.selectCar_run(map);
		return list;
	}

	@Override
	public int selSize(String car_id, String date_save_ele) {
		
		Map<String,Object> map = new HashMap<String,Object>() ;
		if(car_id == null){
			car_id = "";
		}
		if(date_save_ele == null){
			date_save_ele = "";
		}
		map.put("car_id", car_id);
		map.put("date_save_ele", date_save_ele);
		log.debug(map);
		int result = irun_car.selectSize(map);
		return result;
	}

}
